
USE [bmig_Mensual_Post_cadena]
GO

IF EXISTS (SELECT name FROM   sysobjects WHERE  name = 'WASP_M0011_CREATBL_Seg_SaludM' AND type = 'P')
    DROP PROCEDURE [dbo].[WASP_M0011_CREATBL_Seg_SaludM]
GO

CREATE PROCEDURE [dbo].[WASP_M0011_CREATBL_Seg_SaludM]

AS

BEGIN 
			if exists (select * from dbo.sysobjects where id = object_id(N'[seg_saludM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
			drop table [seg_saludM]

			CREATE TABLE [seg_saludM] (
				[TipoRegistro]			[varchar]  (1)	COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
				[PeriodoPro]			[varchar]  (6)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[FechaEnvio]			[varchar]  (8)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[NroCorrelativoArchivo] [varchar]  (6)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[TipoMovimiento]		[varchar]  (2)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[NroProducto]			[varchar]  (4)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[NroPoliza]				[varchar]  (8)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[CodAgen]				[numeric]  NULL ,
				[NroCredito]			[varchar]  (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[RutAsegurado]			[varchar]  (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[DVAsegurado]			[varchar]  (1)	COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[NombreAsegurado]		[varchar]  (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[DireccionAsegurado]	[varchar]  (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[TelefonoAsegurado]		[varchar]  (9)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[CodigoComuna]			[varchar]  (4)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[DescripcionComuna]		[char]     (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[CodigoCiudad]			[varchar]  (3)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[DescripcionCuidad]		[varchar]  (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[CodigoRegion]			[varchar]  (3)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[DescripcionRegion]		[char]     (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[VigenciaDesde]			[varchar]  (8)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[VigenciaHasta]			[varchar]  (8)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[CuotasPactadas]		[varchar]  (3)  COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[PrimaNetaCaja]			[varchar]  (14) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[PrimaBrutaCaja]		[varchar]  (14) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
				[PrimaBrutaPesos]		[varchar]  (14) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
			) ON [PRIMARY]

END